from typing import List


class Date:
    """
    日期时间相关常量
    """

    FORMAT_DATE_TIME: str = "%Y-%m-%d %H:%M:%S"
    FORMAT_DATE_TIGHT: str = "%Y%m%d"
    FORMAT_DATE: str = "%Y-%m-%d"
    FORMAT_TIME: str = "%H:%M:%S"
    FORMAT_YEAR: str = "%Y"
    FORMAT_MONTH: str = "%m"
    FORMAT_DAY: str = "%d"
    FORMAT_HOUR: str = "%H"
    FORMAT_MINUTE: str = "%M"

    FORMATS: List[str] = [
        FORMAT_DATE_TIME,
        FORMAT_DATE_TIGHT,
        FORMAT_DATE,
        FORMAT_TIME,
        FORMAT_YEAR,
        FORMAT_MONTH,
        FORMAT_DAY,
        FORMAT_HOUR,
        FORMAT_MINUTE,
    ]

    @staticmethod
    def is_valid_format(fmt: str = "") -> bool:
        return fmt in Date.FORMATS
